/**
 * 路由类型定义(模块化--值得学)
 * 1.导出组件类型定义
 * 2.导出路由记录接口
 */
import { defineComponent } from 'vue';
import type { RouteMeta, NavigationGuard } from 'vue-router';

// 导出组件类型定义(返回值类型定义、Promise固定类型、Promise不限制类型)
export type Component<T = any> =
  | ReturnType<typeof defineComponent>
  | (() => Promise<typeof import('*.vue')>)
  | (() => Promise<T>);

// 导出路由记录接口(路由配置类型限制)
export interface AppRouteRecordRaw {
  path: string;
  name?: string | symbol;
  meta?: RouteMeta;
  redirect?: string;
  component: Component | string;
  children?: AppRouteRecordRaw[];
  alias?: string | string[];
  props?: Record<string, any>;
  beforeEnter?: NavigationGuard | NavigationGuard[];
  fullPath?: string;
}
